package com.fj.order.feign;

import com.fj.domain.Product;
import com.fj.order.feign.fallback.ProductServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author fj
 * @date 2024/3/12 12:03
 */
@FeignClient(value = "shop-product",path = "product", fallback = ProductServiceFallBack.class)
public interface ProductService {

    @RequestMapping(value = "{pid}",method = RequestMethod.GET)
    Product getProduct(@PathVariable Integer pid);

    @RequestMapping(value = "reduceStock",method = RequestMethod.POST)
    Product reduceStock(@RequestParam(value = "pid") Integer pid, @RequestParam(value = "number") Integer number);
}
